package com.hmdp.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * ClassName: RedissonConfig
 * Package: com.hmdp.config
 * Description: Redisson的配置类
 *
 * @Author:
 * @Create: 2024/5/6 - 12:48
 * @Version: v1.0
 */
@Configuration
public class RedissonConfig {

    @Bean
    public RedissonClient redissonClient() {
        // 配置
        Config config = new Config();
        // 设置单个服务器
        config.useSingleServer()
                .setAddress("redis://192.168.200.188:6379")
                .setPassword("322930");
        // 创建RedissonClient对象
        return Redisson.create(config);
    }
}
